#ifndef IMAGELIST_H_INCLUDED
#define IMAGELIST_H_INCLUDED

#include <iostream>
#include <list>
#include "ID_Manager.h"
#include "Mutex_Wrapper.h"
#include "Image_Wrapper.h"
#include "SpriteList.h"
#include "Debug.h"

using namespace std;

class ImageListItem
{
        public:
        uint m_imgId;
        Image_Wrapper *m_pImg;
        SpriteList m_spriteList;
        string m_id;
};

class  ImageList
{
    list<ImageListItem> m_images;
    Mutex_Wrapper m_mutex;

    protected:
    static ImageList *instance;

    public:
    ImageList();
    bool add(uint id, const string &imagePath);
    Image_Wrapper *find(uint id);
    static ImageList* get_instance();
    static void destroy();
    SpriteList &getSpriteList(uint imgId);
    ImageListItem & operator[](uint imgId);
    void clear();
    ~ImageList();
};

inline ImageList::~ImageList()
{
    clear();
}

#endif // IMAGELIST_H_INCLUDED
